package com.hooya.fa.eu.biz.controller;

import com.hooya.fa.eu.biz.service.EuSupplementOrderService;
import com.hooya.integrated.common.core.util.R;
import com.hooya.integrated.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Description 审计补充订单
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/10/16
 * @Version 1.1.0
 */
@Validated
@RestController
@Tag(name = "补单")
@RequiredArgsConstructor
@RequestMapping("/supplement")
public class EuSupplementOrderController {

    private final EuSupplementOrderService euSupplementOrderService;

    @PostMapping("/container/order")
    @Inner(value = false)
    @Operation(summary = "补充柜子的转运销售订单【√】",
            description = "根据柜子合同号号，补充转运销售订单（将之前因柜子确实而导致的转运销售异常的单子回溯至正常）" +
                    "需要知道柜子合同号，当月正常流程跑完后的”fds公司删除订单计数“是多少")
    public R<Void> containerOrder(@RequestBody @NotNull List<String> fpInvoiceList,
                                  @RequestParam("xsDeleteNum") Integer xsDeleteNum) {
        euSupplementOrderService.containerOrder(fpInvoiceList, xsDeleteNum);
        return R.ok();
    }

    @PostMapping("/before/order")
    @Inner(value = false)
    @Operation(summary = "补充前N个月的转运销售订单【√】", description = "获取前N个月的遗漏转运销售订单，进行补漏")
    public R<Void> beforeOrder(Integer month) {
        euSupplementOrderService.beforeZyXsOrder(month);
        return R.ok();
    }

}
